//***SOUND***//
#pragma once
#include <windows.h>
#include <dxerr.h>
#include <dsound.h>
#include "dsutil.h"
#include "dxutil.h"
#include <string>

#pragma comment(lib, "dxerr.lib")
#pragma comment(lib, "dsound.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "winmm.lib")

class sdManager
{
public:
	static sdManager& getsInstance()
	{
		static sdManager sInstance;
		return sInstance;
	}
	bool initDS(HWND hwnd);//initialize direct sound
	void shutdownDS(void);//shutdown, and delete things

	void toggleMusic();//function to turn on and off the music
	void ring();//play the sound that is supposed to be for when you click on something

private:
	bool music_on;//to say if the music is on or not
	sdManager(void);//default constructor
	~sdManager(void);//destructor
	HRESULT                 hr;
	//LPDIRECTSOUNDBUFFER LoadWaveToSoundBuffer(std::string wavFilename);

	//DirectSound functions and variables
	LPDIRECTSOUND8 pDS; //The DirectSound Device
	LPDIRECTSOUNDBUFFER DSBuffer;//directsound buffer//for music in this project
	LPDIRECTSOUNDBUFFER DSBuffer2;//directsound buffer//for the sound when you click on a jewel
	LPDIRECTSOUNDBUFFER LoadWaveToSoundBuffer(std::string wavFileName);//load sound into one of the created buffers
	void playSound(LPDIRECTSOUNDBUFFER whichBuffer);//play the sound once
	void stopSound(LPDIRECTSOUNDBUFFER whichBuffer);//stop the sound
	void playSoundLoop(LPDIRECTSOUNDBUFFER whichBuffer);//loop the sound

	bool loadSB();//load the sound buffer

};